package com.qf.config;

import com.qf.job.MyJob;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticJobConfig {

    @Bean
    public ScheduleJobBootstrap myJobBootstrap(CoordinatorRegistryCenter createRegistryCenter, MyJob myJob, JobConfiguration myJobConfiguration){
        ScheduleJobBootstrap jobBootstrap = new ScheduleJobBootstrap(createRegistryCenter, myJob, myJobConfiguration);
        jobBootstrap.schedule();
        return jobBootstrap;
    }
}
